using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using CSP.Model.CSP;

namespace CSP.DataAccess.Mapping
{
    public class ServiceTypeMap : EntityTypeConfiguration<ServiceType>
    {
        public ServiceTypeMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("ServiceType");
            this.Property(t => t.Id).HasColumnName("id");
            this.Property(t => t.Name).HasColumnName("name");
            this.Property(t => t.OrderId).HasColumnName("orderid");
            this.Property(t => t.ParentId).HasColumnName("parentId");
            this.Property(t => t.Level).HasColumnName("level");
            this.Property(t => t.Status).HasColumnName("status");

        }
    }
}
